Alist of major modes and their opinion on `default-directory', as
a lisp expression to evaluate. A resulting value of `nil' is
ignored in favor of `default-directory'.
`default-directory'
Function with usage like variable `default-directory', but knows
about the special cases in variable `default-directory-alist'.
The following dired-x commands take special care about the current
Dired directory:
`find-this-file'
Bind this to `C-x C-f' as a replacement for `find-file' that will
prompt for the filename within the current Dired subdirectory, not
the top level directory.
`find-this-file-other-window'
Bind this to `C-x 4 C-f' as a replacement for
`find-file-other-window'.
`dired-smart-shell-command'
Like function `shell-command', but in the current Tree Dired
directory. Bound to `M-!' in Dired buffers.
`dired-smart-background-shell-command'
Like function `background', but in the current Tree Dired
directory. Bound to `M-&' in Dired buffers.
`dired-jump-back'
(Suggested binding `C-x j') Jump back to dired: If in a file,
dired the current directory and move to file's line. If in Dired
already, pop up a level and goto old directory's line. In case
the proper Dired file line cannot be found, refresh the Dired
buffer and try again.
`dired-jump-back-other-window'
(Suggested binding `C-x 4 j') Like `dired-jump-back', but to
other window.
`dired-vm'
(`V') Run VM on this file (assumed to be a UNIX mail folder).
Further `v' commands from within VM in that folder will default
to the folder's directory, not the usual `vm-folder-directory'.
If you give this command a prefix argument, it will visit the
folder read-only. This only works in VM 5, not VM 4.
If the variable `dired-vm-read-only-folders' is t, `dired-vm'
will visit all folders read-only. If it is neither `nil' nor
`t', e.g., the symbol `'if-file-read-only', only files not
writable by you are visited read-only. This is the recommended
value if you run VM 5.
`dired-rmail'
Run Rmail on this file (assumed to be mail folder in Rmail/BABYL
format).
File: dired.info, Node: Dired Local Variables, Next: Making Relative Symbolic Links in Dired, Prev: Multiple Dired Directories, Up: Tree Dired Extra
Local Variables for Dired Directories
=====================================
When Dired visits a directory, it looks for a file whose name is the
value of variable `dired-local-variables-file' (default: `.dired').
If such a file is found, Dired will temporarily insert it into the
Dired buffer and run `hack-local-variables'. *Note Local Variables in
Files: (emacs)File Variables. You can set
`dired-local-variables-file' to `nil' to suppress this.
For example, put
Local Variables:
dired-actual-switches: "-lat"
dired-sort-mode: " by date"
End:
into a `.dired' file of a directory to sort by date only in that
directory. Note that since `dired-hack-local-variables' is run inside
`dired-mode-hook' the modeline has already been set, so you have to
update that for yourself by setting `dired-sort-mode' in addition to
changing the switches.
File: dired.info, Node: Making Relative Symbolic Links in Dired, Next: Letting Dired Guess What Shell Command to Apply, Prev: Dired Local Variables, Up: Tree Dired Extra
Making Relative Symbolic Links in Dired
=======================================
In GNU Emacs version 18, the built-in function `make-symbolic-link'
always calls `expand-file-name' on its arguments, so relative symlinks
(e.g. `foo -> ../bar/foo') are impossible to create.
Dired Extra uses `call-process' and `ln -s' for a workaround.
`dired-make-symbolic-link'
Arguments NAME1 NAME2 and optional OK-IF-ALREADY-EXISTS. Create
file NAME2, a symbolic link pointing to NAME1 (which may be any
string whatsoever and is passed untouched to `ln -s').
OK-IF-ALREADY-EXISTS means that NAME2 will be overwritten if it
already exists. If it is an integer, user will be asked about
this. On error, signals a file-error.
`dired-make-relative-symlink'
Three arguments: FILE1 FILE2 and optional OK-IF-ALREADY-EXISTS.
Make a symbolic link FILE2 (pointing to FILE1). The link is
relative (if possible), for example
(dired-make-relative-symlink "/vol/tex/bin/foo"
"/vol/local/bin/foo")
results in a link
/vol/local/bin/foo -> ../../tex/bin/foo
`dired-do-relsymlink'
(binding `S') Symbolically link all marked (or next N) files into
a directory, or make a symbolic link to the current file. This
creates relative symbolic links like
foo -> ../bar/foo
not absolute ones like
foo -> /ugly/path/that/may/change/any/day/bar/foo
`dired-do-relsymlink-regexp'
(`%S') Symbolically link all marked files containing REGEXP to
NEWNAME, using relative (not absolute) names. See functions
`dired-rename-regexp' and `dired-do-relsymlink' for more info.
File: dired.info, Node: Letting Dired Guess What Shell Command to Apply, Next: dired-trns.el, Prev: Making Relative Symbolic Links in Dired, Up: Tree Dired Extra
Letting Dired Guess What Shell Command to Apply
===============================================
Based upon the name of a filename, Dired tries to guess what shell
command you might want to apply to it. For example, if you have point
on a file named `foo.tar' and you press `!', Dired will guess you want
to `tar xvf' it and suggest that as the default shell command.
If you are using the `gmhist' package (*Note Dired Minibuffer
History::), the default will be mentioned in brackets and you can type
`M-p' to get the default into the minibuffer so that you can edit it,
e.g., changing `tar xvf' to `tar tvf'. If there are several commands
for a given file, e.g., `xtex' and `dvips' for a `.dvi' file, you can
type `M-p' several times to see each of the matching commands.
Dired only tries to guess a command for a single file, never for a
list of marked files.
`dired-auto-shell-command-alist-default'
Predefined rules for shell commands. Set this to nil to turn
guessing off. The elements of `dired-auto-shell-command-alist'
(defined by the user) will override these rules.
`dired-auto-shell-command-alist'
If non-nil, an alist of file regexps and their suggested commands
overriding the predefined rules in
`dired-auto-shell-command-alist-default'.
Each element of the alist looks like
(REGEXP COMMAND...)
where each COMMAND can either be a string or a lisp expression
that evaluates to a string. If several COMMANDs are given, all
will temporarily be pushed on the history.
These rules take precedence over the predefined rules in the
variable `dired-auto-shell-command-alist-default' (to which they
are prepended when `dired-x' is loaded).
You can set this variable in your `~/.emacs'. For example, to
add rules for `.foo' and `.bar' file extensions, write
(setq dired-auto-shell-command-alist
(list
(list "\\.foo$" "FOO-COMMAND");; fixed rule
;; possibly more rules...
(list "\\.bar$";; rule with condition test
'(if CONDITION
"BAR-COMMAND-1"
"BAR-COMMAND-2"))))
This will override any predefined rules for the same extensions.
`dired-guess-have-gnutar'
Default: `nil'
If non-nil, name of the GNU tar executable (e.g., `"tar"' or
`"gnutar"'). GNU tar's `z' switch is used for compressed tar
files. If you don't have GNU tar, set this to nil: a pipe using
`zcat' is then used.
File: dired.info, Node: dired-trns.el, Next: dired-cd.el, Prev: Letting Dired Guess What Shell Command to Apply, Up: Tree Dired Extra
Filename Transformers for Dired Shell Commands
==============================================
File name "transformers" are functions that take a filename (a
string) as an argument and transform it into some other string (e.g.,
a filename without an extension). This package makes transformers
available in Dired shell commands.
For example, running the Dired shell command (type `!' or `M-x'
`dired-do-shell-command')
echo * [b] [db]
would list the full name, the basename, and the absolute basename of
each marked file.
Each transformer is associated with a dispatch character. The
associations are stored in a keymap for fast and easy lookup. The
dispatch character is used to activate the associated transformer
function at a particular position in a shell command issued in Dired.
The dispatch character must be enclosed in brackets to distinguish it
from normal letters.
To take advantage of this package, simply load it after loading
Dired, e.g., in your `dired-load-hook'. You can then use transformers
like "[b]" for the basename in your Dired shell commands (see below).
You can define your own transformers using the macro
`dired-trans-define'.
`dired-trans-define'
Macro that assigns the transformer function `(lambda (file)
BODY)' to CHAR (a character or string). BODY must return a
string: the transformed file.
Several transformers are predefined:
`*'
returns the unmodified filename (equivalent to `[dbe]').
`n'
returns the Name component of a filename without directory
information
`d'
returns the Directory component of a filename
`b'
returns the Basename of a filename, i.e., the name of the file
without directory and extension (see variable
`dired-trans-re-ext') A basename with directory component can be
obtained by `[db]'.
`e'
returns the Extension of a filename (i.e., whatever
`dired-trans-re-ext' splits off)
`v'
returns a file without directory and without `,v' suffixes if any.
`z'
returns a file without directory and without `.Z' suffixes if any.
The following variables can be used to customize `dired-trns.el':
`dired-trans-re-ext'
Default: `"\\.[^.]*\\(\\.Z\\)?$"'
The part of a filename matching this regexp will be viewed as
extension.
`dired-trans-starters'
Default: `"[#[]"'
User definable set of characters to be used to indicate the start
of a transformer sequence.
`dired-trans-enders'
Default: `"[]# ]"'
User definable set of characters to be used to indicate the end
of a transformer sequence.
File: dired.info, Node: dired-cd.el, Next: dired-nstd.el, Prev: dired-trns.el, Up: Tree Dired Extra
Changing the Working Directory for Dired Shell Commands